package com.itboye.ihomebank.activity.myzhujia;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.base.BaseOtherActivity;
import com.itboye.ihomebank.base.MyApplcation;
import com.itboye.ihomebank.constants.SPContants;
import com.itboye.ihomebank.util.SPUtils;

/**
 * 家电维修
 * 
 */
public class ActivityRepairAppliances extends BaseOtherActivity {
	View v_statusbar;
	TextView add_shap_title_tv;
	ImageView close_icon;
	WebView repair_app_web;
	TextView repair_app_ok;

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.close_icon:
			finish();
			break;
		case R.id.repair_app_ok:
			Intent intent = new Intent(MyApplcation.ctx,
					ActivityJvJiaRepair.class);
			intent.putExtra("type", 1);
			startActivity(intent);
			break;
		default:
			break;
		}

	}

	@Override
	protected int layout_id() {
		// TODO Auto-generated method stub
		return R.layout.activity_repair_appliances;
	}

	@Override
	protected void onInitController() {
		// TODO Auto-generated method stub

	}

	@SuppressLint("SetJavaScriptEnabled") @Override
	protected void onInit() {
		setStatusBarHeight(v_statusbar);
		add_shap_title_tv.setText("家电维修");

		// 设置WebView属性,能够执行Javascript脚本
		repair_app_web.getSettings().setJavaScriptEnabled(true);
		repair_app_web.setWebViewClient(new WebViewClient() {
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				view.loadUrl(url);
				return true;
			}
		});

		String url = "http://api.ihomebank.com/public/webview.php";
		String uid = SPUtils.get(this, null, SPContants.USER_ID, "") + "";
		String pass = SPUtils.get(this, null, SPContants.PASSWORD, "") + "";

		String url02 = url + "/repair?uid=" + uid + "&psw=" + pass
				+ "&status=1";
		repair_app_web.loadUrl(url02);

	}

	@Override
	protected void onReadIntent(Bundle bundle) {
		// TODO Auto-generated method stub

	}

}
